<!--
Dim cr, t, q
Function ReplaceCharacters(TextSource, ContiguousCharacters, ReplaceWith)
    a = TextSource
    s = ContiguousCharacters
    r = ReplaceWith
    X = 1
    Do
        X = InStr(X, a, s)
        If X Then 
            a = Left(a, X - 1) & r & Mid(a, X + Len(s))
            X = X + Len(r)
        End If
    Loop While X
    ReplaceCharacters = a
End Function
Sub window_onload()
    cr = Chr(13) & Chr(10): t = Chr(9): q = Chr(34)
    CleanHREFS
    CleanMAPS
    TitleLogo
    MakeContents
	AddFooter
	ProgrammerDisplay
	On Error Resume Next
    Synchronizer
    on error goto 0
    Messages
End Sub
Sub Messages
    p = LCase(window.Document.url)
    If InStr(p, "messages.htm") = 0 Then Exit Sub
    Set hh = Document.body.All.tags("A")
    For Each h In hh
        b = h.innerTEXT
        Set im = h.parentElement.children.tags("IMG").Item(0)
        if not im is nothing then
            ClearFromCharacters b, Chr(13)
            ClearFromCharacters b, Chr(10)
            ClearFromCharacters b, Chr(9)
            m = m & "<A HREF = #" & im.name & ">" & b & "</A><BR>"
        end if
    Next
    MessageC.innerHTML = m
End Sub
Sub Synchronizer
    a = LCase(window.Document.url)
    do 
        x = Instr(a, "\")
        if x then a = Mid(a, x +1)
    Loop while x
    x = Instr(a, "#")
    if x then a = Left(a, x-1)
    ClearFromCharacters a, "%20"
    Set w = window.Parent.Frames("Top").Diagram
    If Not w Is Nothing Then
        For Each n In w.Nodes
            If LCase(n.Tag) = a Then Exit For
        Next
        If Not n Is Nothing Then
            Set cn = w.SelectedItem
            if n is cn then exit sub
            if n.tag = cn.tag then exit sub
            Set w.SelectedItem = n
            n.EnsureVisible
        End If
    End If
End Sub
'===================================================================================
'The contents with their hypertext link are inserted in the <DIV> tag with id = Contents.
'The <A> tags with id = Heading or id = Subheading are identifired by the script.
'====================================================================================
'   <DIV id = Contents>
'Contents
'   </DIV>
Sub MakeContents
    s = "&nbsp;&nbsp;&nbsp;"
    Set hh = Document.body.All.tags("A")
    For Each h In hh
        c = Trim(h.href)
        if len(c) = 0 then
            b = Trim(h.innerText)
            qs = ""
            qe = ""
            Select Case Lcase(h.ID)
                Case "heading":		d = "": qs = "<STRONG>": qe = "</STRONG>"
                Case "subheading":  d = s
                Case Else:          b = ""
            End Select
            If Len(b) Then
		    	If Right(b, 1) = "." Then b = Left(b, Len(b) -1)
                a = a & d & "<A HREF=" & q & "#" & h.Name & q
                a = a & " style=" & q & "font-style=italic" & q
                a = a & ">" & qs & b & qe & "</A><BR>"
            End If
        End if
    Next
	on error resume next
    If Len(a) Then
		Contents.innerHTML = "<DIR>" & a & "</DIR>"
	End If
End Sub
Sub TitleLogo
    Dim s
    On Error Resume Next
    Set t = Title
    If Not t Is Nothing Then
        a = t.innerHTML
        s = "<TABLE width=100% cellspacing = 0 cellpadding=10>"
        s = s & "</TD><TD color = RGB(128,0,0) align = left><FONT id=Title>" & a
        s = s & "</TD><TD align=right>"
        s = s & "<img src=fisalo6.gif align=absmiddle>"
        s = s & "</TD></TR></TABLE></FONT>"
        Title.innerHTML = s
    End If
End Sub
Sub AddFooter
'    Footer = UCase("img src=" & q & "fisalo2.gif" & q )
 '   a = UCase(Document.body.innerHTML)
  '  If InStr(a, Footer) = 0 Then
   '     Footer = "<BR><BR><BR><BR><BR><BR><" & Footer & " WIDTH = 100%>"
    '    Document.body.innerHTML = Document.body.innerHTML & Footer
    'End If
End Sub
Sub CleanHREFS
    Set hh = Document.body.All.tags("A")
    For Each h In hh
        a = h.href
        If Len(a) Then
			b = h.InnerHTML
            ClearFromCharacters b, Chr(13)
            ClearFromCharacters b, Chr(10)
            ClearFromCharacters b, Chr(9)
            h.innerHTML = Trim(b)
        End If
    Next
End Sub
Sub ClearFromCharacters(Text, ContiguousCharacters)
    Dim x
    Do
        x = InStr(Text, ContiguousCharacters)
        If x Then Text = Left(Text, x - 1) & " " & Mid(Text, x + Len(ContiguousCharacters))
    Loop While x
End Sub
Sub CleanMAPS
    Set hh = Document.body.All.tags("MAP")
    For Each h In hh
        b = h.innerHTML
        If Len(b) Then
            ClearFromCharacters b, "&#13;"
            ClearFromCharacters b, "&#10;"
            ClearFromCharacters b, "&#9;"
            ClearFromCharacters b, "  "
            h.innerHTML = Trim(b)
        End If
    Next
End Sub
Sub ProgrammerDisplay()
    For Each e In document.All
        If e.id <> "" Then
            If LCase(e.id) = "formatdisplay" Then
                FormatAsDisplay e
            End If
        End If
    Next
End Sub
Sub FormatAsDisplay(e)
    Dim r, a, b, h, v(), x, cr, i, j, fs
    cr = "<P>"
    ReDim v(6)
    For i = 1 To 6: v(i) = "": Next
    a = Trim(e.innerHTML)
    StripFromCrLF a
    i = 0
    Do
        i = i + 1
        x = InStr(a, cr)
        If x = 0 Then Exit Do
        v(i) = Trim(Left(a, x - 1))
        a = Mid(a, x + Len(cr))
    Loop While x
    For j = 0 To 3 Step 3
        If Len(v(1 + j)) = 0 And Len(v(3 + j)) = 0 Then
            fs = 40
        Else
			b = v(1 + j)
            v(1 + j) = b & SpaceString(9 - Len(b))
            b = v(3 + j)
            v(3 + j) = SpaceString(9 - Len(b)) & b
            fs = 22
        End If
        x = fs - Len(v(2 + j))
        y = Int(x / 2)
        x = x - y
        v(2 + j) = SpaceString(x) & v(2 + j) & SpaceString(y)
    Next
    a = v(1) & v(2) & v(3)
    b = v(4) & v(5) & v(6)
    h = "<TABLE border=2 cellPadding=5 cellSpacing=2 bgcolor=silver>"
    h = h & "<TR><TD align = center>"
    h = h & "<FONT id=Line>" & a & "<BR>" & b & "</FONT>"
    h = h & "</TD></TR></TABLE>"
    e.innerHTML = h
End Sub
Sub StripFromCrLF(a)
    Dim x, s
    s = Chr(13) & Chr(10)
    x = 0
    Do
        x = InStr(a, s)
        If x Then a = Left(a, x - 1) & Mid(a, x + Len(s))
    Loop While x
End Sub
Function SpaceString(x)
    Dim a, i
    For i = 1 To x
        a = a & "&nbsp;"
    Next
    SpaceString = a
End Function
-->
